package com.itheima.service;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.http.ResponseEntity;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import com.github.pagehelper.PageInfo;
import com.itheima.po.UploadFile;

public interface FilenameService {
	// 上传文件到本地
	public String handleFormUpload(String name, List<MultipartFile> uploadfile, HttpServletRequest request,
			Model model);

	// 下载文件
	public ResponseEntity<byte[]> fileDownload(HttpServletRequest request, String filename) throws IOException;

	// 获取文件名字
	public String getFilename(HttpServletRequest request, String filename) throws UnsupportedEncodingException;

	// 根据页码查询
	public PageInfo<UploadFile> findByPage(Integer pageNum, Integer pageSize);

	// 根据文件名模糊查询
	public List<UploadFile> findByCondition(String filename);

	// 根据id查询
	public UploadFile findById(Integer id);

	// 添加文件到数据库
	public int addFile(UploadFile uploadFile);

	// 更新文件名
	public int updateUploadFile(UploadFile uploadfile);

	// 删除文件
	public int deleteFile(Integer id);

	// 改本地名字
	public String FixFileName(HttpServletRequest request, String oldFileName, String newFileName);

}
